package cms.manage.template.value.impl;

import cms.bean.template.Column;
import cms.bean.template.Forum;
import cms.manage.template.impl.ColumnTemplateManage;
import cms.manage.template.value.TplValueStrategy;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

import static cms.common.SystemConstant.DisplayType.DISPLAY_COLLECTION;

@Service("站点栏目")
public class ColumnTemplateStratey implements TplValueStrategy<List<Column>> {
    @Resource
    ColumnTemplateManage columnTemplateManage;// 站点栏目 -- 模板方法实现

    @Override
    public List<Column> doOperation(Forum forum, Map submitParameter, Map runtimeParameter) {
        if (StringUtils.equals(forum.getForumChildType(), "站点栏目列表")) {
            if (forum.getDisplayType().equals(DISPLAY_COLLECTION.getValue())) {//集合
                List<Column> value = columnTemplateManage.columnCollection(forum, submitParameter, runtimeParameter);
                return value;
            }
        }
        return null;
    }
}
